home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / X11 / makedepend.z / makedepend
Text File  |  1998-10-30  |  14KB  |  265 lines

  1.  
  2.  
  3.  
  4.      MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))      XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111))))       MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           makedepend - create dependencies in makefiles
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd [ ----DDDD_n_a_m_e====_d_e_f ] [ ----DDDD_n_a_m_e ] [ ----IIII_i_n_c_l_u_d_e_d_i_r ] [
  13.           ----YYYY_i_n_c_l_u_d_e_d_i_r ] [ ----aaaa ] [ ----ffff_m_a_k_e_f_i_l_e ] [ ----oooo_o_b_j_s_u_f_f_i_x ] [
  14.           ----pppp_o_b_j_p_r_e_f_i_x ] [ ----ssss_s_t_r_i_n_g ] [ ----wwww_w_i_d_t_h ] [ ----vvvv ] [ ----mmmm ] [ --
  15.           _o_t_h_e_r_o_p_t_i_o_n_s -- ] _s_o_u_r_c_e_f_i_l_e ...
  16.  
  17.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.           The mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd program reads each _s_o_u_r_c_e_f_i_l_e in sequence and
  19.           parses it like a C-preprocessor, processing all #_i_n_c_l_u_d_e,
  20.           #_d_e_f_i_n_e, #_u_n_d_e_f, #_i_f_d_e_f, #_i_f_n_d_e_f, #_e_n_d_i_f, #_i_f, #_e_l_i_f and
  21.           #_e_l_s_e directives so that it can correctly tell which
  22.           #_i_n_c_l_u_d_e, directives would be used in a compilation.  Any
  23.           #_i_n_c_l_u_d_e, directives can reference files having other
  24.           #_i_n_c_l_u_d_e directives, and parsing will occur in these files
  25.           as well.
  26.  
  27.           Every file that a _s_o_u_r_c_e_f_i_l_e includes, directly or
  28.           indirectly, is what mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd calls a _d_e_p_e_n_d_e_n_c_y.  These
  29.           dependencies are then written to a _m_a_k_e_f_i_l_e in such a way
  30.           that mmmmaaaakkkkeeee((((1111)))) will know which object files must be recompiled
  31.           when a dependency has changed.
  32.  
  33.           By default, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd places its output in the file named
  34.           _m_a_k_e_f_i_l_e if it exists, otherwise _M_a_k_e_f_i_l_e. An alternate
  35.           makefile may be specified with the ----ffff option.  It first
  36.           searches the makefile for the line
  37.  
  38.               # DO NOT DELETE THIS LINE -- make depend depends on it.
  39.  
  40.           or one provided with the ----ssss option, as a delimiter for the
  41.           dependency output.  If it finds it, it will delete
  42.           everything following this to the end of the makefile and put
  43.           the output after this line.  If it doesn't find it, the
  44.           program will append the string to the end of the makefile
  45.           and place the output following that.  For each _s_o_u_r_c_e_f_i_l_e
  46.           appearing on the command line, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd puts lines in the
  47.           makefile of the form
  48.  
  49.                sourcefile.o: dfile ...
  50.  
  51.           Where _s_o_u_r_c_e_f_i_l_e._o is the name from the command line with
  52.           its suffix replaced with ``.o'', and _d_f_i_l_e is a dependency
  53.           discovered in a #_i_n_c_l_u_d_e directive while parsing _s_o_u_r_c_e_f_i_l_e
  54.           or one of the files it included.
  55.  
  56.      EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  57.           Normally, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd will be used in a makefile target so
  58.           that typing ``make depend'' will bring the dependencies up
  59.           to date for the makefile.  For example,
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 4/30/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))      XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111))))       MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
  71.  
  72.  
  73.  
  74.               SRCS = file1.c file2.c ...
  75.               CFLAGS = -O -DHACK -I../foobar -xyz
  76.               depend:
  77.                       makedepend -- $(CFLAGS) -- $(SRCS)
  78.  
  79.      OOOOPPPPTTTTIIIIOOOONNNNSSSS
  80.           The program will ignore any option that it does not
  81.           understand so that you may use the same arguments that you
  82.           would for cccccccc((((1111))))....
  83.  
  84.           ----DDDD_n_a_m_e====_d_e_f or ----DDDD_n_a_m_e
  85.                Define.  This places a definition for _n_a_m_e in
  86.                mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd''''ssss symbol table.  Without =_d_e_f the symbol
  87.                becomes defined as ``1''.
  88.  
  89.           ----IIII_i_n_c_l_u_d_e_d_i_r
  90.                Include directory.  This option tells mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to
  91.                prepend _i_n_c_l_u_d_e_d_i_r to its list of directories to search
  92.                when it encounters a #_i_n_c_l_u_d_e directive.  By default,
  93.                mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd only searches the standard include
  94.                directories (usually /usr/include and possibly a
  95.                compiler-dependent directory).
  96.  
  97.           ----YYYY_i_n_c_l_u_d_e_d_i_r
  98.                Replace all of the standard include directories with
  99.                the single specified include directory; you can omit
  100.                the _i_n_c_l_u_d_e_d_i_r to simply prevent searching the standard
  101.                include directories.
  102.  
  103.           ----aaaa   Append the dependencies to the end of the file instead
  104.                of replacing them.
  105.  
  106.           ----ffff_m_a_k_e_f_i_l_e
  107.                Filename.  This allows you to specify an alternate
  108.                makefile in which mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd can place its output.
  109.                Specifying ``-'' as the file name (i.e., ----ffff----) sends the
  110.                output to standard output instead of modifying an
  111.                existing file.
  112.  
  113.           ----oooo_o_b_j_s_u_f_f_i_x
  114.                Object file suffix.  Some systems may have object files
  115.                whose suffix is something other than ``.o''.  This
  116.                option allows you to specify another suffix, such as
  117.                ``.b'' with -_o._b or ``:obj'' with -_o:_o_b_j and so forth.
  118.  
  119.           ----pppp_o_b_j_p_r_e_f_i_x
  120.                Object file prefix.  The prefix is prepended to the
  121.                name of the object file. This is usually used to
  122.                designate a different directory for the object file.
  123.                The default is the empty string.
  124.  
  125.           ----ssss_s_t_r_i_n_g
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 4/30/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))      XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111))))       MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
  137.  
  138.  
  139.  
  140.                Starting string delimiter.  This option permits you to
  141.                specify a different string for mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to look for
  142.                in the makefile.
  143.  
  144.           ----wwww_w_i_d_t_h
  145.                Line width.  Normally, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd will ensure that
  146.                every output line that it writes will be no wider than
  147.                78 characters for the sake of readability.  This option
  148.                enables you to change this width.
  149.  
  150.           ----vvvv   Verbose operation.  This option causes mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to
  151.                emit the list of files included by each input file on
  152.                standard output.
  153.  
  154.           ----mmmm   Warn about multiple inclusion.  This option causes
  155.                mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to produce a warning if any input file
  156.                includes another file more than once.  In previous
  157.                versions of mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd this was the default behavior;
  158.                the default has been changed to better match the
  159.                behavior of the C compiler, which does not consider
  160.                multiple inclusion to be an error.  This option is
  161.                provided for backward compatibility, and to aid in
  162.                debugging problems related to multiple inclusion.
  163.  
  164.           -------- _o_p_t_i_o_n_s --------
  165.                If mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd encounters a double hyphen (--) in the
  166.                argument list, then any unrecognized argument following
  167.                it will be silently ignored; a second double hyphen
  168.                terminates this special treatment.  In this way,
  169.                mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd can be made to safely ignore esoteric
  170.                compiler arguments that might normally be found in a
  171.                CFLAGS mmmmaaaakkkkeeee macro (see the EEEEXXXXAAAAMMMMPPPPLLLLEEEE section above).  All
  172.                options that mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd recognizes and appear between
  173.                the pair of double hyphens are processed normally.
  174.  
  175.      AAAALLLLGGGGOOOORRRRIIIITTTTHHHHMMMM
  176.           The approach used in this program enables it to run an order
  177.           of magnitude faster than any other ``dependency generator''
  178.           I have ever seen.  Central to this performance are two
  179.           assumptions:  that all files compiled by a single makefile
  180.           will be compiled with roughly the same -_I and -_D options;
  181.           and that most files in a single directory will include
  182.           largely the same files.
  183.  
  184.           Given these assumptions, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd expects to be called
  185.           once for each makefile, with all source files that are
  186.           maintained by the makefile appearing on the command line.
  187.           It parses each source and include file exactly once,
  188.           maintaining an internal symbol table for each.  Thus, the
  189.           first file on the command line will take an amount of time
  190.           proportional to the amount of time that a normal C
  191.           preprocessor takes.  But on subsequent files, if it
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 4/30/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))      XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111))))       MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
  203.  
  204.  
  205.  
  206.           encounters an include file that it has already parsed, it
  207.           does not parse it again.
  208.  
  209.           For example, imagine you are compiling two files, _f_i_l_e_1._c
  210.           and _f_i_l_e_2._c, they each include the header file _h_e_a_d_e_r._h, and
  211.           the file _h_e_a_d_e_r._h in turn includes the files _d_e_f_1._h and
  212.           _d_e_f_2._h. When you run the command
  213.  
  214.               makedepend file1.c file2.c
  215.  
  216.           mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd will parse _f_i_l_e_1._c and consequently, _h_e_a_d_e_r._h and
  217.           then _d_e_f_1._h and _d_e_f_2._h. It then decides that the
  218.           dependencies for this file are
  219.  
  220.               file1.o: header.h def1.h def2.h
  221.  
  222.           But when the program parses _f_i_l_e_2._c and discovers that it,
  223.           too, includes _h_e_a_d_e_r._h, it does not parse the file, but
  224.           simply adds _h_e_a_d_e_r._h, _d_e_f_1._h and _d_e_f_2._h to the list of
  225.           dependencies for _f_i_l_e_2._o.
  226.  
  227.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  228.           cc(1), make(1)
  229.  
  230.      BBBBUUUUGGGGSSSS
  231.           mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd parses, but does not currently evaluate, the SVR4
  232.           #predicate(token-list) preprocessor expression; such
  233.           expressions are simply assumed to be true.  This may cause
  234.           the wrong #_i_n_c_l_u_d_e directives to be evaluated.
  235.  
  236.           Imagine you are parsing two files, say _f_i_l_e_1._c and _f_i_l_e_2._c,
  237.           each includes the file _d_e_f._h. The list of files that _d_e_f._h
  238.           includes might truly be different when _d_e_f._h is included by
  239.           _f_i_l_e_1._c than when it is included by _f_i_l_e_2._c. But once
  240.           mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd arrives at a list of dependencies for a file, it
  241.           is cast in concrete.
  242.  
  243.      AAAAUUUUTTTTHHHHOOOORRRR
  244.           Todd Brunhoff, Tektronix, Inc. and MIT Project Athena
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 4/30/98)
  262.  
  263.  
  264.  
  265.